package com.lyf.shop.service.impl;

import java.util.List;
import com.lyf.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.lyf.shop.mapper.NumberMapper;
import com.lyf.shop.domain.Number;
import com.lyf.shop.service.INumberService;

/**
 * 会员Service业务层处理
 * 
 * @author lyf
 * @date 2023-04-08
 */
@Service
public class NumberServiceImpl implements INumberService 
{
    @Autowired
    private NumberMapper numberMapper;

    /**
     * 查询会员
     * 
     * @param numberId 会员主键
     * @return 会员
     */
    @Override
    public Number selectNumberByNumberId(Long numberId)
    {
        return numberMapper.selectNumberByNumberId(numberId);
    }

    /**
     * 查询会员列表
     * 
     * @param number 会员
     * @return 会员
     */
    @Override
    public List<Number> selectNumberList(Number number)
    {
        return numberMapper.selectNumberList(number);
    }

    /**
     * 新增会员
     * 
     * @param number 会员
     * @return 结果
     */
    @Override
    public int insertNumber(Number number)
    {
        number.setCreateTime(DateUtils.getNowDate());
        return numberMapper.insertNumber(number);
    }

    /**
     * 修改会员
     * 
     * @param number 会员
     * @return 结果
     */
    @Override
    public int updateNumber(Number number)
    {
        number.setUpdateTime(DateUtils.getNowDate());
        return numberMapper.updateNumber(number);
    }

    /**
     * 批量删除会员
     * 
     * @param numberIds 需要删除的会员主键
     * @return 结果
     */
    @Override
    public int deleteNumberByNumberIds(Long[] numberIds)
    {
        return numberMapper.deleteNumberByNumberIds(numberIds);
    }

    /**
     * 删除会员信息
     * 
     * @param numberId 会员主键
     * @return 结果
     */
    @Override
    public int deleteNumberByNumberId(Long numberId)
    {
        return numberMapper.deleteNumberByNumberId(numberId);
    }

     public boolean updateByDay()
    {
     return numberMapper.updateByDay() >0;
    }
}
